﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;


namespace SocialNetworks.Config
{
	/// <summary>
	/// Summary description for TwitterConfig
	/// </summary>
	public class TwitterConfig : Social.Twitter.ITwitterConfig
	{

		#region ITwitterConfig Members

		public string ConsumerKey
		{
			get { return ConfigurationManager.AppSettings["TwitterConsumerKey"]; }
		}

		public string ConsumerSecret
		{
			get { return ConfigurationManager.AppSettings["TwitterConsumerSecret"]; }
		}

		public string AccessToken { get; set; }

		public string AccessTokenSecret { get; set; }

		public string ScreenName { get; set; }

		public long Uid { get; set; }

		public string RedirectUrl
		{
			get { return AppParams.URLs.TwRedirectUrl(HttpContext.Current.Request["ID"]); }
		}

		public void SaveAccessToken()
		{
			int accountID;
			int.TryParse(HttpContext.Current.Request["ID"], out accountID);
			Logic.BusinessLogic.AccountService.UpdateTwToken(accountID, AccessToken, AccessTokenSecret, Uid, ScreenName);
		}
		#endregion


		
	}
}